package com.xinxuchu.design.principle.openclose;

/**
 * @program: java_learning
 * @description
 * @author: 辛旭初
 * @create: 2023-01-29 19:54
 **/
public class Test {

    /**
     * 开闭原则：一个软件实体如类、模块和函数应该对扩展开发、对修改关闭
     * 例如本次的ICourse接口实现、和javaCourse实现ICourse接口，这两个基础模块不做改动，新增JavaDiscountCourse继承javaCourse进行后续的业务处理
     * @param args
     */
    public static void main(String[] args) {
        ICourse iCourse = new JavaDiscountCourse(90, "from one to three", 444d);
        JavaDiscountCourse javaCourse = (JavaDiscountCourse) iCourse;
        System.out.println("course id:" + javaCourse.getId() + " course name:" + javaCourse.getName()
                + " course origin price:" + javaCourse.getOriginPrice() + " course price:" + javaCourse.getPrice());
    }
}
